package com.ruiysoft.controller.sms;

import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
import com.ruiysoft.sms.util.AliyunSdk;
import org.springframework.web.client.RestTemplate;

public class SmsContoller {
    public static void main(String[] args) {
        CommonRequest re= AliyunSdk.assembleRequest(MethodType.POST,"SendSms","SMS_174585448","禾泽果业","18610348075","胖大海,你买的重启娃娃已经下单成功");
        IAcsClient client=AliyunSdk.getInstance();
        try {
            CommonResponse response=client.getCommonResponse(re);
            System.out.println(response.getData());
        } catch (ClientException e) {
            e.printStackTrace();
        }
    }


  /*  public static void main(String[] args) {
        DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", "LTAIbEq2a6mEvjFJ", "nzhLeXnjcaJCQCKqozy0Mo5cXH61Zq");
        IAcsClient client = new DefaultAcsClient(profile);

        CommonRequest request = new CommonRequest();
        request.setMethod(MethodType.POST);
        request.setDomain("dysmsapi.aliyuncs.com");
        request.setVersion("2017-05-25");
        request.setAction("SendSms");
        request.putQueryParameter("RegionId", "cn-hangzhou");
        request.putQueryParameter("PhoneNumbers", "13051399951");
        request.putQueryParameter("SignName", "ruiysoft");
        request.putQueryParameter("TemplateCode", "SMS_174580436");
        try {
            CommonResponse response = client.getCommonResponse(request);
            System.out.println(response.getData());
        } catch (ServerException e) {
            e.printStackTrace();
        } catch (ClientException e) {
            e.printStackTrace();
        }
    }*/
}
